<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML>
<html>
<head>
  <title>后台管理系统</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link href="/resources/css/dpl-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/bui-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/page-min.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" charset="utf-8" src="/resources/ueditor/ueditor.config.js"></script>
  <script type="text/javascript" charset="utf-8" src="/resources/ueditor/ueditor.all.min.js"> </script>
</head>
<body>

<div class="container">
  <form id="J_Form" class="form-horizontal" action="/dictionary/save">
    <input type="hidden" name="id" value="${data.id}"/>
    <div class="row">
      <div class="control-group span20">
        <label class="control-label"><s>*</s>名称：</label>
        <div class="controls">
          <input name="name" type="text" data-rules="{maxlength:20}" value="${data.name}" class="input-normal control-text" style="width:200px;">
        </div>
      </div>
    </div>

    <div class="row">
      <div class="control-group span20">
        <label class="control-label">key：</label>
        <div class="controls">
          <input name="type" type="text" data-rules="{maxlength:10}" value="${data.type}" class="input-normal control-text">
        </div>
      </div>
    </div>

    <div class="row">
      <div class="control-group span20">
        <label class="control-label">详情：</label>
        <div style="display:inline;height:40px;margin-left: 10px;">
          <script id="editor" type="text/plain" style="width:800px;height:300px;margin-left:10px;">${data.content}</script>
          <input type="hidden" name="content" id="content"/>
        </div>
      </div>
    </div>

    <div class="row form-actions actions-bar">
      <div class="span13 offset3 ">
        <button type="submit" class="button button-primary">保存</button>
       <button type="button" class="button" onclick="back()">返回</button>
      </div>
    </div>
  </form>
</div>
<script type="text/javascript" src="/resources/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="/resources/js/bui-min.js"></script>
<script type="text/javascript" src="/resources/js/config-min.js"></script>

<script type="text/javascript">
  var ue = UE.getEditor('editor',{
    elementPathEnabled:false,
    enableAutoSave:false
  });
  BUI.use('common/page'); //页面链接跳转
  BUI.use(['bui/tree','bui/form','bui/uploader'],function (Tree,Form,Uploader) {

    var form = new Form.HForm({
      srcNode: '#J_Form',
      submitType: "ajax",
      listeners: {
        beforesubmit: function () {
          $("#content").val(ue.getContent());
          return true;
        }
      },
      callback: function (data) {
        BUI.Message.Alert(data.msg, function () {
          if (data.success) {
            back();
          }
        }, 'info');
      }
    });

    form.render();
  });

  function back(){
    top.topManager.openPage({
      id : 'dictionary_list',
      isClose : true
    });
    top.topManager.reloadPage('dictionary_list');
  }
</script>

<body>
</html> 